#define LIMIT_UI

using System;
using System.Collections.Generic;

using AGG;
using AGG.VertexSource;
using AGG.UI;

namespace DemoSelectorApp
{
    public class GroupBox : GUIWidget
    {
        public override void OnDraw(Graphics2D graphics2D)
        {
            base.OnDraw(graphics2D);
            RoundedRect roundRect = new RoundedRect(Bounds, 0);
            graphics2D.Render(roundRect, new RGBA_Bytes(0, 0, 0, 30));

            graphics2D.DrawString(this.Text, Bounds.Left, Bounds.Top);
        }
    }

    public class DemoSelector : MatchParentBoundsWidget
    {
        private GroupBox groupBox1;
#if !LIMIT_UI
        private GroupBox groupBox2;
        private GroupBox groupBox3;
        private GroupBox groupBox5;
#endif

        private ButtonWidget button1;
#if !LIMIT_UI
        private ButtonWidget button2;
        private ButtonWidget button3;
        private ButtonWidget button4;
        private ButtonWidget button5;
        private ButtonWidget button6;
        private ButtonWidget button7;
        private ButtonWidget button8;
        private ButtonWidget button9;
        private ButtonWidget button10;
        private ButtonWidget button11;
        private ButtonWidget button12;
        private ButtonWidget button15;
        private ButtonWidget button14;
        private ButtonWidget button16;
        private ButtonWidget button13;
        private ButtonWidget button17;
#endif

        public DemoSelector()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            AGG.image1_application.StartDemo();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            AGG.rounded_rect_application.StartDemo();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            AGG.component_rendering_application.StartDemo();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            AGG.blur_application.StartDemo();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            AGG.perspective_application.StartDemo();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            AGG.lion_outline_application.StartDemo();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            AGG.gouraud_application.StartDemo();
        }

        private void button9_Click(object sender, EventArgs e)
        {
            AGG.image_filters_application.StartDemo();
        }

        private void button10_Click(object sender, EventArgs e)
        {
            AGG.image_resample_application.StartDemo();
        }

        private void button11_Click(object sender, EventArgs e)
        {
            AGG.alpha_mask2_application.StartDemo();
        }

        private void button12_Click(object sender, EventArgs e)
        {
            AGG.gradients_application.StartDemo();
        }

        private void button14_Click(object sender, EventArgs e)
        {
            RockBlaster.RockBlasterGame.StartDemo();
        }

        private void button15_Click(object sender, EventArgs e)
        {
            SmartSweeper.SmartSweeperApplication.StartDemo();
        }

        private void button16_Click(object sender, EventArgs e)
        {
            MomsSolitaire.MomsSolitaire_application.StartDemo();
        }

        private void button13_Click(object sender, EventArgs e)
        {
            AGG.line_patterns_application.StartDemo();
        }

        private void InitializeComponent()
        {
            this.button1 = new ButtonWidget();
#if !LIMIT_UI
            this.button2 = new ButtonWidget();
            this.button3 = new ButtonWidget();
            this.button4 = new ButtonWidget();
            this.button5 = new ButtonWidget();
            this.button6 = new ButtonWidget();
            this.button12 = new ButtonWidget();
            this.button8 = new ButtonWidget();
            this.button7 = new ButtonWidget();
            this.button13 = new ButtonWidget();
            this.button10 = new ButtonWidget();
            this.button9 = new ButtonWidget();
            this.button11 = new ButtonWidget();
            this.button16 = new ButtonWidget();
            this.button15 = new ButtonWidget();
            this.button14 = new ButtonWidget();
            this.button17 = new ButtonWidget();
#endif

            this.groupBox1 = new GroupBox();
#if !LIMIT_UI
            this.groupBox2 = new GroupBox();
            this.groupBox3 = new GroupBox();
            this.groupBox5 = new GroupBox();
#endif

            
            this.groupBox1.SuspendLayout();
#if !LIMIT_UI
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.groupBox5.SuspendLayout();
#endif
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new Vector2D(6, 106);
            this.button1.Name = "button1";
            //this.button1.Size = new Vector2D(134, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "Lion";
#if !LIMIT_UI
            // 
            // button2
            // 
            this.button2.Location = new Vector2D(6, 18);
            this.button2.Name = "button2";
            //this.button2.Size = new Vector2D(134, 23);
            this.button2.TabIndex = 1;
            this.button2.Text = "Image1";
            this.button2.Click += new ButtonWidget.ButtonEventHandler(this.button2_Click);
            // 
            // button3
            // 
            this.button3.Location = new Vector2D(6, 48);
            this.button3.Name = "button3";
            //this.button3.Size = new Vector2D(134, 23);
            this.button3.TabIndex = 2;
            this.button3.Text = "Rounded Rect";
            this.button3.Click += new ButtonWidget.ButtonEventHandler(this.button3_Click);
            // 
            // button4
            // 
            this.button4.Location = new Vector2D(6, 19);
            this.button4.Name = "button4";
            //this.button4.Size = new Vector2D(134, 23);
            this.button4.TabIndex = 3;
            this.button4.Text = "Component Rendering";
            this.button4.Click += new ButtonWidget.ButtonEventHandler(this.button4_Click);
            // 
            // button5
            // 
            this.button5.Location = new Vector2D(6, 19);
            this.button5.Name = "button5";
            //this.button5.Size = new Vector2D(134, 23);
            this.button5.TabIndex = 4;
            this.button5.Text = "Blur";
            this.button5.Click += new ButtonWidget.ButtonEventHandler(this.button5_Click);
            // 
            // button6
            // 
            this.button6.Location = new Vector2D(6, 193);
            this.button6.Name = "button6";
            //this.button6.Size = new Vector2D(134, 23);
            this.button6.TabIndex = 5;
            this.button6.Text = "Perspective";
            this.button6.Click += new ButtonWidget.ButtonEventHandler(this.button6_Click);
#endif
            // 
            // groupBox1
            // 
            //this.groupBox1.AddChild(this.button17);
            //this.groupBox1.AddChild(this.button12);
            //this.groupBox1.AddChild(this.button8);
            //this.groupBox1.AddChild(this.button7);
            //this.groupBox1.AddChild(this.button6);
            //this.groupBox1.AddChild(this.button4);
            //this.groupBox1.AddChild(this.button3);
            this.groupBox1.AddChild(this.button1);
            this.groupBox1.Location = new Vector2D(12, 12);
            //this.groupBox1.Location = new Vector2D(0, 12);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new Vector2D(147, 259);
            this.groupBox1.TabIndex = 6;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Vector";
#if !LIMIT_UI
            // 
            // button12
            // 
            //this.button12.Location = new Vector2D(6, 222);
            this.button12.Name = "button12";
            //this.button12.Size = new Vector2D(134, 23);
            this.button12.TabIndex = 8;
            this.button12.Text = "Gradients";
            this.button12.Click += new ButtonWidget.ButtonEventHandler(this.button12_Click);
            // 
            // button8
            // 
            this.button8.Location = new Vector2D(6, 77);
            this.button8.Name = "button8";
            //this.button8.Size = new Vector2D(134, 23);
            this.button8.TabIndex = 7;
            this.button8.Text = "Gouraud";
            this.button8.Click += new ButtonWidget.ButtonEventHandler(this.button8_Click);
            // 
            // button7
            // 
            this.button7.Location = new Vector2D(6, 164);
            this.button7.Name = "button7";
            //this.button7.Size = new Vector2D(134, 23);
            this.button7.TabIndex = 6;
            this.button7.Text = "Lion Outline";
            this.button7.Click += new ButtonWidget.ButtonEventHandler(this.button7_Click);
            // 
            // groupBox2
            // 
            this.groupBox2.AddChild(this.button13);
            this.groupBox2.AddChild(this.button10);
            this.groupBox2.AddChild(this.button9);
            this.groupBox2.AddChild(this.button2);
            //this.groupBox2.Location = new Vector2D(165, 12);
            this.groupBox2.Name = "groupBox2";
            //this.groupBox2.Size = new Vector2D(147, 146);
            this.groupBox2.TabIndex = 7;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Bitmap";
            // 
            // button13
            // 
            this.button13.Location = new Vector2D(6, 106);
            this.button13.Name = "button13";
            //this.button13.Size = new Vector2D(134, 23);
            this.button13.TabIndex = 4;
            this.button13.Text = "Line Patterns";
            this.button13.Click += new ButtonWidget.ButtonEventHandler(this.button13_Click);
            // 
            // button10
            // 
            this.button10.Location = new Vector2D(6, 76);
            this.button10.Name = "button10";
            //this.button10.Size = new Vector2D(134, 23);
            this.button10.TabIndex = 3;
            this.button10.Text = "Image Resample";
            this.button10.Click += new ButtonWidget.ButtonEventHandler(this.button10_Click);
            // 
            // button9
            // 
            this.button9.Location = new Vector2D(6, 47);
            this.button9.Name = "button9";
            //this.button9.Size = new Vector2D(134, 23);
            this.button9.TabIndex = 2;
            this.button9.Text = "Image Filters";
            this.button9.Click += new ButtonWidget.ButtonEventHandler(this.button9_Click);
            // 
            // groupBox3
            // 
            this.groupBox3.AddChild(this.button11);
            this.groupBox3.AddChild(this.button5);
            //this.groupBox3.Location = new Vector2D(165, 164);
            this.groupBox3.Name = "groupBox3";
            //this.groupBox3.Size = new Vector2D(147, 107);
            this.groupBox3.TabIndex = 8;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Effects";
            // 
            // button11
            // 
            this.button11.Location = new Vector2D(6, 48);
            this.button11.Name = "button11";
            //this.button11.Size = new Vector2D(134, 23);
            this.button11.TabIndex = 5;
            this.button11.Text = "Alpha Mask2";
            this.button11.Click += new ButtonWidget.ButtonEventHandler(this.button11_Click);
            // 
            // groupBox5
            // 
            this.groupBox5.AddChild(this.button16);
            this.groupBox5.AddChild(this.button15);
            this.groupBox5.AddChild(this.button14);
            //this.groupBox5.Location = new Vector2D(318, 12);
            this.groupBox5.Name = "groupBox5";
            //this.groupBox5.Size = new Vector2D(147, 259);
            this.groupBox5.TabIndex = 10;
            this.groupBox5.TabStop = false;
            this.groupBox5.Text = "Fun && Games";
            // 
            // button16
            // 
            this.button16.Location = new Vector2D(6, 79);
            this.button16.Name = "button16";
            //this.button16.Size = new Vector2D(134, 23);
            this.button16.TabIndex = 6;
            this.button16.Text = "Mom\'s Solitaire";
            this.button16.Click += new ButtonWidget.ButtonEventHandler(this.button16_Click);
            // 
            // button15
            // 
            this.button15.Location = new Vector2D(6, 48);
            this.button15.Name = "button15";
            //this.button15.Size = new Vector2D(134, 23);
            this.button15.TabIndex = 5;
            this.button15.Text = "Smart Sweepers";
            this.button15.Click += new ButtonWidget.ButtonEventHandler(this.button15_Click);
            // 
            // button14
            // 
            this.button14.Location = new Vector2D(6, 19);
            this.button14.Name = "button14";
            //this.button14.Size = new Vector2D(134, 23);
            this.button14.TabIndex = 4;
            this.button14.Text = "Rock Blaster";
            this.button14.Click += new ButtonWidget.ButtonEventHandler(this.button14_Click);
            // 
            // button17
            // 
            this.button17.Location = new Vector2D(6, 135);
            this.button17.Name = "button17";
            //this.button17.Size = new Vector2D(134, 23);
            this.button17.TabIndex = 9;
            this.button17.Text = "Lion OpenGL";
            this.button17.Click += new ButtonWidget.ButtonEventHandler(this.button17_Click);
#endif
            // 
            // DemoSelector
            // 
            //this.AutoScaleDimensions = new Vector2DF(6F, 13F);
            //this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            //this.ClientSize = new Vector2D(471, 308);
            //this.AddChild(this.groupBox5);
            //this.AddChild(this.groupBox3);
            this.AddChild(this.groupBox1);
            //this.AddChild(this.groupBox2);
            this.Name = "DemoSelector";
            this.Text = "Form1";
            this.groupBox1.ResumeLayout(false);
#if !LIMIT_UI
            this.groupBox2.ResumeLayout(false);
            this.groupBox3.ResumeLayout(false);
            this.groupBox5.ResumeLayout(false);
#endif
            this.ResumeLayout(false);
        }

        public override void OnDraw(Graphics2D graphics2D)
        {
            base.OnDraw(graphics2D);
        }

        [STAThread]
        public static void Main(string[] args)
        {
            GuiHalFactory.SetGuiBackend(GuiHalFactory.KnownGuiFactoriesIndexes.WindowsFormsBitmap);

            GuiHalSurface.PixelFormat pixelFormat = GuiHalSurface.PixelFormat.PixelFormatBgra32;
            GuiHalSurface primaryWindow = GuiHalFactory.CreatePrimarySurface(471, 308, GuiHalSurface.CreateFlags.Resizable, pixelFormat);

            primaryWindow.Caption = "Demo Selector";

            DemoSelector app = new DemoSelector();
            primaryWindow.AddChild(app);

            primaryWindow.Run();
        }
    }
}
